package jnpf.ureport.model;

import jnpf.univer.sheet.UniverSheetColumnData;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;


@Setter
@Getter
public class Column {
    private int width;
    private boolean hide;
    /**
     * 一个用来临时存放当前列号的属性，只在构建报表时创建新列时使用
     */
    private int tempColumnNumber;
    private List<Column> columns;

    private List<Cell> cells = new ArrayList<>();


    private UniverSheetColumnData sheetColumnData;

    public Column(List<Column> columns) {
        this.columns = columns;
    }

    public Column newColumn() {
        Column col = new Column(columns);
        col.setWidth(width);
        col.setSheetColumnData(sheetColumnData);
        return col;
    }

    public int getColumnNumber() {
        return this.columns.indexOf(this) + 1;
    }

}
